package ru.ifmo.mlarinsky.classificator.model;

/**
 *
 * @author Михаил
 */
public final class Quote implements Comparable<Quote> {
    private final String symbol;
    private final QuoteDate date;
    private final double openPrice;
    private final double highPrice;
    private final double lowPrice;
    private final double closePrice;
    private final int volume;

    public Quote(String symbol, QuoteDate date, double openPrice, double highPrice,
            double lowPrice, double closePrice, int volume)
    {
        this.symbol = symbol;
        this.date = date;
        this.openPrice = openPrice;
        this.highPrice = highPrice;
        this.lowPrice = lowPrice;
        this.closePrice = closePrice;
        this.volume = volume;
    }

    public int compareTo(Quote o) {
        if (o == null || o.getDate() == null)
            return 1;
        return date.compareTo(o.getDate());
    }

    public double getClosePrice() {
        return closePrice;
    }

    public QuoteDate getDate() {
        return date;
    }

    public double getHighPrice() {
        return highPrice;
    }

    public double getLowPrice() {
        return lowPrice;
    }

    public double getOpenPrice() {
        return openPrice;
    }

    public String getSymbol() {
        return symbol;
    }

    public int getVolume() {
        return volume;
    }

    @Override
    public String toString() {
        return "Quote{" + "symbol=" + symbol + " date=" + date + " openPrice=" +
                openPrice + " highPrice=" + highPrice + " lowPrice=" + lowPrice +
                " closePrice=" + closePrice + " volume=" + volume + '}';
    }

    public enum QuoteField {
        OPEN_PRICE,
        HIGH_PRICE,
        LOW_PRICE,
        CLOSE_PRICE,
        VOLUME
    }
}
